package com.java.exam;

public class StringTests {
    public static void main(String[] args) {
        String str="123az45d67xyz89";
        str=str.replaceAll("[a-z]+","***" );
        System.out.println(str);
        System.out.println(getString("abc123.456"));
    }
    private static String getString(String str){
        String getNumber=str.replaceAll("[a-z|A-Z]","");
        if(getNumber.indexOf(".")==-1){
            getNumber=getNumber+".00";
        }else{
            if(getNumber.indexOf(".")==getNumber.length()-1){
                getNumber=getNumber+"00";
            }else if(getNumber.indexOf(".")==getNumber.length()-2){
                getNumber=getNumber+"0";
            }else{
                getNumber=getNumber.substring(0,getNumber.indexOf(".")+3);
            }
        }
        return getNumber;
    }
}
